﻿<%@ Page Language="C#" Title="FWD弯沉监测" MasterPageFile="~/W_View/PageMaster.Master" CodeBehind="S_RdfwdPage.aspx.cs" Inherits="STHPMS1.Web.W_View.Survey.S_RdfwdPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/datagrid.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/Jquery/ajaxfileupload.js")%>
    
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/dropdown.js")%>    
    <%= UiHelper.RefJsFileHtml("/Scripts/TypeScript/Enum.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/TypeScript/Bussiness.js")%>

    <script type="text/javascript">      

        function S_RdfwdEdit(flag)
        {
            var row = $('#dg').datagrid('getSelected');

            $('#fm').form('clear');
            $('#fm').form('load', row);
            $('#dlg').dialog('open');
        }

        function S_RdfwdDel() {
            var row = $('#dg').datagrid('getSelected');
            if (!row) {
                $.messager.alert('消息提示', '删除数据时，请选择一项!', 'warning');
                return;
            }

            deleteData($('#dg'), $('#dlg'), "/api/rdfwd");
        }



        function search(n, o) {
            var road = $('#cmbRoads').combobox("getValue");
            var checkDate = $('#checkDate').datebox('getValue');  //注意.datebox('getValue')

            var url = '/api/rdfwd';
            var urlParam = "";
            if (road != "" && road != "0") urlParam += "road=" + encodeURI(road) + "&";
            if (checkDate != "") urlParam += "checkDate=" + encodeURI(checkDate) + "&";
            if (urlParam != "") {
                urlParam = "?" + urlParam.substring(0, urlParam.length - 1);
                url = url + urlParam;
            }

            $('#dg').datagrid({ url: url, pageNumber: 1 });
        }
       

        $(function () {
            var number= '<%= Page.RouteData.Values["page"] %>';
            var size = '<%= Page.RouteData.Values["size"] %>';

            dataGridBind($('#dg'), '/api/rdfwd', 'FWD弯沉列表显示', $('#tb'), number, size);

            $('.validatebox-text').bind('blur', function () {
                $(this).validatebox('enableValidation').validatebox('validate');
            });
        })

        
    </script>    

    <script>
        //导入的点击事件
        function impt() {
            $("#linkUpload").text("上传");

            $('#dlgImport').dialog('open');
        }

        function closeFile() {
            $("#linkUpload").text("上传");
            $('#dlgImport').dialog('close');
            $("#fileHid").val('');//清空隐藏域
        }
        //上传
        function ajaxFileUpload() {
            $.ajaxFileUpload
            (
                {
                    url: '/api/rdfwd/uploadFile', //用于文件上传的服务器端请求地址
                    secureuri: false, //是否需要安全协议，一般设置为false
                    fileElementId: 'file1', //文件上传域的ID
                    dataType: 'string', //返回值类型 一般设置为json
                    success: function (path)  //服务器成功响应处理函数
                    {
                        //写入隐藏域
                        $("#fileHid").val(path);
                        $("#linkUpload").text("上传成功");
                    },
                    error: function (data, status, e)//服务器响应失败处理函数
                    {
                        alert(e);

                    }
                }
            )
            return false;
        }
        //上传文件验证
        function upLoad() {
            if ($("#linkUpload").text() == "上传") {
                var file = $("#file1").val();//上传文件
                if (file == "") {
                    alert("请选择上传数据");
                    return;
                }
                else {
                    var extStart = file.lastIndexOf(".");
                    var ext = file.substring(extStart, file.length).toUpperCase();
                    if (ext != ".XLS" && ext != ".XLSX") {
                        alert("请上传有效Excel文件");
                        return;
                    }
                }
                ajaxFileUpload();
            }
        }
        //导入处理
        function saveFile() {
          
            var file = $("#fileHid").val();//上传后的Excel路径
            if (file == "") {
                alert("请上传数据文件");
                return;
            }

            $.ajax({
                url: "/api/rdfwd/saveFile?file=" + encodeURI(file) ,
                type: "post",
                success: function (msg) {
                    $("#fileHid").val('');//清空隐藏域
                    $('#dlgImport').dialog('close');
                    search(null, null);
                },

                error: function (msg) {
                    //错误处理
                    alert(msg.responseText);
                    closeFile();
                }
            });
        }

       

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table id="dg" class="easyui-datagrid content-place"  ajaxCached="false"  >
        <thead>
            <tr>
                <th data-options="field:'Fwdid',editor:'text',width:80,align:'right' ,hidden:true" >弯沉Id</th>
                <th data-options="field:'Rdwayid',editor:'text',width:80,align:'right' ">路线编号</th>       
                <th data-options="field:'Direction_Dictid',editor:'numberbox',width:80,align:'center'" formatter="formatDirection">行车方向</th> 
                <th data-options="field:'Fwdmp',editor:'numberbox',width:80,align:'right' " formatter="formatPile">测点桩号(km)</th>    
                <th data-options="field:'Svydata',editor:'datebox',width:120,align:'right' " formatter="formatDate">检测日期</th>
                <th data-options="field:'His_Version',editor:'numberbox',width:80,align:'center' ,hidden:true">养护版本</th>
                <th data-options="field:'Surveyer',editor:'text',width:80,align:'right' ">检测人员</th>
                <th data-options="field:'Device',editor:'text',width:80,align:'right' ">检测设备</th>
                <th data-options="field:'Load',editor:'numberbox',width:80,align:'right' ">荷载（kPa）</th>
                <th data-options="field:'Done',editor:'numberbox',width:80,align:'right' ">D1(μm)</th>
                <th data-options="field:'Dtwo',editor:'numberbox',width:80,align:'right' ">D2(μm)</th>
                <th data-options="field:'Dthree',editor:'numberbox',width:80,align:'right' ">D3(μm)</th>
                <th data-options="field:'Dfour',editor:'numberbox',width:80,align:'right' ">D4(μm)</th>
                <th data-options="field:'Dfive',editor:'numberbox',width:80,align:'right' ">D5(μm)</th>
                <th data-options="field:'Dsix',editor:'numberbox',width:80,align:'right' ">D6(μm)</th>
                <th data-options="field:'Dseve',editor:'numberbox',width:80,align:'right' ">D7(μm)</th>
                <th data-options="field:'Deig',editor:'numberbox',width:80,align:'right' ">D8(μm)</th>
                <th data-options="field:'Dnin',editor:'numberbox',width:80,align:'right' ">D9(μm)</th>
                <th data-options="field:'Pvmt_Temp',editor:'numberbox',width:80,align:'right' ">路表温度(℃)</th>
                <th data-options="field:'Air_Temp',editor:'numberbox',width:80,align:'right' ">空气温度(℃)</th>
                <th data-options="field:'Importdate',editor:'datebox',width:80,align:'right' ,hidden:true" formatter="formatDate">导入时间</th>
            </tr>
        </thead>
    </table>
   
    <!--测试数据命令-->
    <div id="tb">
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="S_RdfwdEdit(-1)">编辑</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="S_RdfwdDel()">删除</a> 
         <a href="/down?type=fwd" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true">模板下载</a>      
         <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-redo',plain:true" onclick="impt()">导入</a>   
        <select id="cmbRoads" class="easyui-combobox" panelHeight="80" style="width:100px" data-options="prompt:'路线编号',url:'/api/roadway/dict',method:'get',valueField:'id',textField:'id',onChange:search">
        </select>
	    <input id="checkDate" class="easyui-datebox"  data-options="prompt:'观测日期',onChange:search"/>
    </div>

    <!--测试详细页面-->
    <div id="dlg" class="easyui-dialog" title="保存数据" style="width:350px;height:400px;padding:10px" closed="true"  data-options="
				iconCls: 'icon-save',
				buttons: '#dlg-buttons'
			">
        <form id="fm" method="post" action="/api/rdfwd">
            <table>	 
                 <tr>
                   <td>路线编号:</td>
                    <td><input name='Rdwayid'  class=" easyui-combobox" data-options="required:true,readonly:true,valueField:'Rdwayid',textField:'Name',panelHeight:'auto',url:'/api/roadway/all',method:'get'"/></td>
                </tr>	
                 <tr>
                    <td>行车方向:</td>
                     <td><input  name='Direction_Dictid' class=' easyui-combobox'  data-options="required:true,readonly:true,valueField:'id',textField:'text',panelHeight:'auto',url:'/api/data/direction',method:'get'" /></td>
                </tr>                  
                 <tr style="display:none">
                    <td>养护版本:</td>
                    <td><input name='His_Version' class='easyui-numberbox' data-options="required:true,readonly:true"/></td>
                </tr>         
                <tr>
                    <td>检测日期:</td>
                    <td><input name='Svydata' class='easyui-validatebox easyui-datebox'  data-options="required:true"/></td>
                </tr>
                <tr>
                    <td>测点桩号(km):</td>
                    <td><input name='Fwdmp' class='easyui-validatebox easyui-numberbox'  data-options="required:true,min:0,precision:2,formatter:formatPile" /></td>
                </tr>
                <tr>
                    <td>检测人员:</td>
                    <td><input name='Surveyer' class='easyui-validatebox easyui-textbox'  data-options="validType:'MaxLength[50]'"/></td>
                </tr>
                <tr>
                    <td>检测设备:</td>
                    <td><input name='Device' class='easyui-validatebox easyui-textbox'  data-options="validType:'MaxLength[10]'"/></td>
                </tr>
                <tr>
                    <td>荷载（kPa）:</td>
                    <td><input name='Load' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>D1(μm):</td>
                    <td><input name='Done' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>D2(μm):</td>
                    <td><input name='Dtwo' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>D3(μm):</td>
                    <td><input name='Dthree' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>D4(μm):</td>
                    <td><input name='Dfour' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>D5(μm):</td>
                    <td><input name='Dfive' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>D6(μm):</td>
                    <td><input name='Dsix' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>D7(μm):</td>
                    <td><input name='Dseve' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>D8(μm):</td>
                    <td><input name='Deig' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>D9(μm):</td>
                    <td><input name='Dnin' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>路表温度(℃):</td>
                    <td><input name='Pvmt_Temp' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>空气温度(℃):</td>
                    <td><input name='Air_Temp' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr style="display:none">
                    <td>导入时间:</td>
                    <td><input name='Importdate' class='easyui-validatebox easyui-datebox'  /></td>
                </tr>                
                <tr style="display:none">
                    <td>弯沉ID:</td>
                    <td><input name='Fwdid' class='easyui-validatebox easyui-textbox'  data-options="validType:'MaxLength[50]'"/></td>
                </tr>-
		    </table>
        </form>
    </div>

    <!--编辑数据命令-->
    <div id="dlg-buttons">
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:sumbitData($('#dg'),$('#dlg'))">保存</a>
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:$('#dlg').dialog('close')">取消</a>
	</div>

     <!--导入数据-->
    <div id="dlgImport" class="easyui-dialog" title="导入数据" style="width: 320px; height: 250px; padding: 10px" closed="true" data-options="
				iconCls: 'icon-save',
				buttons: '#dlg-buttonsImport'
			">
        <table>
               
                <tr>
                    <td>导入源:</td>
                    <td>
                        <input id="id_type" type="hidden" />
                        <input id="fileHid" type="hidden" />
                        <input type="file" id="file1" name="file" style="width: 150px"/>
                        <a href="javascript:void(0)" id="linkUpload"  onclick="javascript:upLoad();">上传</a>
                    </td>
                </tr>
        </table>
    </div>
    <!--导入数据命令-->
    <div id="dlg-buttonsImport">
        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:saveFile();">确定</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:closeFile()">取消</a>
    </div>


</asp:Content>
